DWStrListimplements an indexed doubly-linked list for
the DWSTRING (Unicode dynamic string) data type.
Include file : DWStrProcs.inc
Using the dotted syntax:
' // Build the linked list
DIM List AS DWStrList
List.Add("Result 1")
List.Add("Result 2")
List.Add("Result 3")
List.Insert(1, "New string")
List.Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List.Count
PRINT List.Item(i)
NEXT
Using NEW and the pointer syntax:
' // Build the linked list
DIM List AS DWStrList PTR = NEW DWStrList
List->Add("Result 1")
List->Add("Result 2")
List->Add("Result 3")
List->Insert(1, "New string")
List->Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List->Count
PRINT List->Item(i)
NEXT
' // Delete the list
Delete List
| Name | Description |
|---|---|
| Add | Appends an item to the list. |
| Clear | Empties the entire list. |
| Count | Returns the number of items in the list. |
| Insert | Inserts an item at the specific index. |
| Item | Retrieves the item at the specified index. |
| Remove | Removes the specified item from the list. |
| Replace | Replaces the item at the specified index. |
DVarListimplements an indexed doubly-linked list for the
DVARIANT (dynamic variant) data type. A
DVARIANT can contain any kind of data except fixed-length
string data (if you pass it as the input it will be converted to a
unicode dynamic string).
Include file : DVariant.inc
Using the dotted syntax:
' // Build the linked list
DIM List AS DVarList
List.Add("Result 1")
List.Add("Result 2")
List.Add("Result 3")
List.Insert(1, "New string")
List.Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List.Count
PRINT List.Item(i)
NEXT
Using NEW and the pointer syntax:
' // Build the linked list
DIM List AS DVarList PTR = NEW DVarList
List->Add("Result 1")
List->Add("Result 2")
List->Add("Result 3")
List->Insert(1, "New string")
List->Replace(2, "Replaced string")
' // Retrieve and print the results
FOR i AS LONG = 1 TO List->Count
PRINT List->Item(i)
NEXT
' // Delete the list
Delete List
| Name | Description |
|---|---|
| Add | Appends an item to the list. |
| Clear | Empties the entire list. |
| Count | Returns the number of items in the list. |
| Insert | Inserts an item at the specific index. |
| Item | Retrieves the item at the specified index. |
| Remove | Removes the specified item from the list. |
| Replace | Replaces the item at the specified index. |
Appends a string to the list.
FUNCTION Add (BYREF dws AS DWSTRING) AS LONG
| Parameter | Description |
|---|---|
| dws | The string to append. |
Returns the number of items in the list.
Empties the entire list.
SUB Clear
Returns the number of items in the list.
FUNCTION Count () AS LONG
Returns the number of items in the list.
Inserts an item at the specific index.
FUNCTION Insert (BYVAL idx AS LONG, BYREF dws AS DWSTRING) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index where to insert the item. |
| dws | The string to insert. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Retrieves the item at the specified index.
FUNCTION Item (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to retrieve. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Removes the specified item from the list. Indexes are one-based.
FUNCTION Remove (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to remove. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Replaces the item at the specified index.
FUNCTION Replace (BYVAL idx AS LONG, BYREF dws AS DWSTRING) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to replace. |
| dws | The replacement string. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Appends a VARIANT to the list.
FUNCTION Add (BYREF dv AS DVARIANT) AS LONG
| Parameter | Description |
|---|---|
| dv | The VARIANT to append. |
Returns the number of items in the list.
Empties the entire list.
SUB Clear
Returns the number of items in the list.
FUNCTION Count () AS LONG
Returns the number of items in the list.
Inserts an item at the specific index.
FUNCTION Insert (BYVAL idx AS LONG, BYREF dv AS DVARIANT) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index where to insert the item. |
| dv | The variant to insert. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Retrieves the item at the specified index.
FUNCTION Item (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to retrieve. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Removes the specified item from the list. Indexes are one-based.
FUNCTION Remove (BYVAL idx AS LONG) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to remove. |
If the method succeeds, it returns TRUE; otherwise, FALSE.
Replaces the item at the specified index.
FUNCTION Replace (BYVAL idx AS LONG, BYREF dv AS DVARIANT) AS BOOLEAN
| Parameter | Description |
|---|---|
| idx | The one-based index of the item to replace. |
| dv | The replacement variant. |
If the method succeeds, it returns TRUE; otherwise, FALSE.